package io.renren.modules.app.service.impl;

import io.renren.common.utils.Query;
import io.renren.modules.app.service.ApiSongService;
import io.renren.modules.sys.dao.*;
import io.renren.modules.sys.entity.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;

/**
 * @author wangyi
 * @mail 794651397@qq.com
 * @createdate 2018/3/16 14:45
 **/
@Service("ApiSongService")
public class ApiSongServiceImpl implements ApiSongService{
    @Autowired
    private SongsetDao songsetDao;
    @Autowired
    private SongDao songDao;
    @Autowired
    private SearchDao searchDao;
    @Autowired
    private HistoryDao historyDao;
    @Autowired
    private TeachDao teachDao;
    @Autowired
    private SongsetRecommendDao songsetRecommendDao;
    @Autowired
    private SongRecommendDao songRecommendDao;
    @Autowired
    private SongNewDao songNewDao;
    @Autowired
    private SongsetNewDao songsetNewDao;

    @Override
    public List<SongsetEntity> recommendSongset(Query query) {
        return songsetRecommendDao.querySongsetList(query);
    }

    @Override
    public List<SongEntity> recommendSong(Query query) {
        return songRecommendDao.querySongList(query);
    }

    @Override
    public List<SongsetEntity> newSongset(Query query) {
        return songsetNewDao.querySongsetList(query);
    }

    @Override
    public List<SongEntity> newSong(Query query) {
        return songNewDao.querySongList(query);
    }

    @Override
    public List<SongsetEntity> recommendSongsetAll(Query query) {
        return songsetRecommendDao.querySongsetList(query);
    }
    @Override
    public int recommendSongsetAllCount(Query query) {
        return songsetRecommendDao.queryTotal(query);
    }

    @Override
    public List<SongEntity> recommendSongAll(Query query) {
        return songRecommendDao.querySongList(query);
    }

    @Override
    public int recommendSongAllCount(Query query) {
        return songRecommendDao.queryTotal(query);
    }

    @Override
    public List<SongsetEntity> newSongsetAll(Query query) {
        return songsetNewDao.querySongsetList(query);
    }

    @Override
    public int newSongsetAllCount(Query query) {
        return songsetNewDao.queryTotal(query);
    }

    @Override
    public List<SongEntity> newSongAll(Query query) {
        return songNewDao.querySongList(query);
    }

    @Override
    public int newSongAllCount(Query query) {
        return songNewDao.queryTotal(query);
    }

    @Override
    public SongsetEntity songsetInfo(Long id) {
        return songsetDao.queryObject(id);
    }

    @Override
    public List<SongEntity> querySongBySongsetId(Long id) {
        return songsetDao.getSongBySetId(id);
    }

    @Override
    public List<SongsetEntity> queryListByClassify(Query query) {
        return songsetDao.queryListByClassify(query);
    }

    @Override
    public int queryListByClassifyCount(Query query) {
        return songsetDao.queryListByClassifyCount(query);
    }

    @Override
    public List<SearchEntity> searchWord() {
        return searchDao.queryList(null);
    }

    @Override
    public List<SongsetEntity> querySongsetByKeyWords(String keywords) {
        return songsetDao.querySongsetByKeyWords(keywords);
    }

    @Override
    public List<SongEntity> querySongByKeyWords(String keywords) {
        return songDao.querySongByKeyWords(keywords);
    }

    @Override
    public void addToHistory(HistoryEntity historyEntity) {
        historyDao.save(historyEntity);
    }

    @Override
    public List<HistoryEntity> getHistory(Long userId) {
        return historyDao.getHistory(userId);
    }

    @Override
    public SongEntity querySongById(Long mediaId) {
        return songDao.queryObject(mediaId);
    }

    @Override
    public VedioEntity queryVedioById(Long mediaId) {
        return historyDao.queryVedioById(mediaId);
    }

    @Override
    public int historyCount(HashMap<String, Object> map) {
        return historyDao.historyCount(map);
    }

    @Override
    public List<TeachEntity> queryTeachByKeyWords(String keywords) {
        return teachDao.queryTeachByKeyWords(keywords);
    }

    @Override
    public List<SongsetEntity> queryGroupSongsetList(Long id) {
        return songsetDao.queryGroupSongsetList(id);
    }
}
